package com.dxt.rabbitmq.service.direct;

import com.dxt.rabbitmq.config.DirectModeConfig;
import com.dxt.rabbitmq.vo.TestMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/*
 * 基本队列消息模型
 *   发送消息
 */
@Service
public class DirectModePublisher {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    public void send(TestMessage testMessage){
        System.out.println("directModePublisher publish message...");
        rabbitTemplate.convertAndSend(DirectModeConfig.EXCHANGE, DirectModeConfig.ROUTING_KEY, testMessage);
    }
}
